﻿package net.wangit.framework.util;

import net.wangit.framework.cache.Cache;
import net.wangit.framework.cache.CacheManager;

/**
 * 缓存工具类，获取缓存中信息
 * 
 * @author watson Feb 14, 2010
 */
public class CacheUtil {

	private static final String TABLE = ".101";
	private static final String ACTION_MAPPING = ".102";
	private static final String PAGE = ".103";
	private static final String UNIT = ".104";
	private static final String ENUMERATION_CONFIG = ".105";
	private static final String ENUMERATION = ".106";
	private static final String TREE_CONFIG = ".107";
	private static final String TREE = ".108";
	private static final String CHART = ".109";
	private static final String DATA_PRIVILEGE = "110";
	private static final String INCREMENTOR = ".111";
	private static final String SYSTEM_MESSAGE = "201";
	private static final String PAGES = "202";
	private static final String MAPPINGS = "203";
	private static final String UNIT_GROUPS = "204";
	private static final String ADMINISTRATOR = "301";
	private static final String ROLE = "302";
	private static final String ORGANIZATION = "303";
	private static final String USERGROUP = "304";

	public CacheUtil() {
	}

	public static Cache getTableCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.TABLE).toString());
	}

	public static Cache getActionMappingCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.ACTION_MAPPING).toString());
	}

	public static Cache getPageCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.PAGE).toString());
	}

	public static Cache getUnitCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.UNIT).toString());
	}

	public static Cache getEnumerationConfigCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.ENUMERATION_CONFIG).toString());
	}

	public static Cache getEnumerationCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.ENUMERATION).toString());
	}

	public static Cache getTreeConfigCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.TREE_CONFIG).toString());
	}

	public static Cache getTreeCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.TREE).toString());
	}

	public static Cache getChartCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.CHART).toString());
	}

	public static Cache getDataPrivilegeCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.DATA_PRIVILEGE).toString());
	}

	public static Cache getIncrementorCache(String domain) {
		return CacheManager
				.getCache((new StringBuilder(String.valueOf(domain))).append(
						CacheUtil.INCREMENTOR).toString());
	}

	public static Cache getMessageCache() {
		return CacheManager.getCache(CacheUtil.SYSTEM_MESSAGE);
	}

	public static Cache getPagesCache() {
		return CacheManager.getCache(CacheUtil.PAGES);
	}

	public static Cache getUnitGroupsCache() {
		return CacheManager.getCache(CacheUtil.UNIT_GROUPS);
	}

	public static Cache getMappingsCache() {
		return CacheManager.getCache(CacheUtil.MAPPINGS);
	}

	public static Cache getAdministratorCache() {
		return CacheManager.getCache(CacheUtil.ADMINISTRATOR);
	}

	public static Cache getRoleCache() {
		return CacheManager.getCache(CacheUtil.ROLE);
	}

	public static Cache getOrganizationCache() {
		return CacheManager.getCache(CacheUtil.ORGANIZATION);
	}

	public static Cache getUserGroupCache() {
		return CacheManager.getCache(CacheUtil.USERGROUP);
	}
}
